<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1 , user-scalable=no">
    <title>图片分享社区后台</title>
   <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/CSS/bootstrap.css" />
  <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/CSS/bootstrap-maizi.css" />
</head>
<body>
<!--导航-->
<nav class="navbar navbar-default">
    <div class="container">
        <!--小屏幕导航按钮和logo-->
        <div class="navbar-header">
            <button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a href="head.action" class="navbar-brand">图片分享社区后台</a>
        </div>
        <!--小屏幕导航按钮和logo-->
        <!--导航-->
        <div class="navbar-collapse collapse">
             <ul class="nav navbar-nav">
                <li ><a href="head.action"><span class="glyphicon glyphicon-home"></span>&nbsp;&nbsp;后台首页</a></li>
                <li ><a href="usermanger.action"><span class="glyphicon glyphicon-user"></span>&nbsp;&nbsp;用户管理</a></li>
                <li class="active"><a href="contentmanger.action"><span class="glyphicon glyphicon-list-alt"></span>&nbsp;&nbsp;内容管理</a></li>
                <li><a href="labelmanger.action"><span class="glyphicon glyphicon-tags"></span>&nbsp;&nbsp;标签管理</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
               <li class="dropdown">
                    <a id="dLabel" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                       <s:property value="#session.USER_NAME"/>
                        <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu" aria-labelledby="dLabel">
                         <li><a href="<%=basePath%>"><span class="glyphicon glyphicon-screenshot"></span>&nbsp;&nbsp;前台首页</a></li>
                        
                         <li><a href="personsetting.action?id=<s:property value="#session.USER_ID"/>"><span class="glyphicon glyphicon-cog"></span>&nbsp;&nbsp;个人设置</a></li>
      
                    </ul>
                </li>
                <li><a href="logout.action"><span class="glyphicon glyphicon-off"></span>&nbsp;&nbsp;退出</a></li>
            </ul>
        </div>
        <!--导航-->

    </div>
</nav>
<!--导航-->

<div class="container">
    <div class="row">
        <div class="col-md-2">
           <div class="list-group">
        <a href="contentmanger.action" class="list-group-item active">内容管理</a>
        <a href="noticemanger.action" class="list-group-item">公告管理</a>
        <a href="noticepublic.action" class="list-group-item ">发布公告</a>
    </div>
        </div>
        <div class="col-md-10">
            <div class="page-header">
                <h1>内容管理</h1>
            </div>
            <ul class="nav nav-tabs">
    <li class="active">
        <a href="contentmanger.action">内容管理</a>
    </li>
    <li >
    <a href="noticemanger.action">公告管理</a>
    </li>
    <li >
        <a href="noticepublic.action">发布公告</a>
    </li>
</ul>
<table class="table">
    <thead>
    <tr>
        <th>内容标题</th>
        <th>作者ID</th>
        <th>发布时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <s:iterator value="sharelist" id="share" >
    <tr>     
        <th scope="row"><s:property value="#share.title" /></th>
       <td><s:property value="#share.userid" /></td>
       <td>20<s:property value="#share.sharetime"/></td>
        <td>
            <div role="presentation" class="dropdown">
                <button class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
                    操作<span class="caret"></span>
                </button>
                <ul class="dropdown-menu">
                    <li><a href="watchcontent.action?id=<s:property value='#share.shareid'/>">查看</a></li>                                        
                    <s:if test="%{#share.type!=0}">
                                   <li><a href="lockcontent.action?id=<s:property value='#share.shareid'/>&&type=<s:property value='#share.type'/>">禁止发布</a></li>
                                  </s:if> 
                                  <s:else>
                                   <li><a href="lockcontent.action?id=<s:property value='#share.shareid'/>&&type=<s:property value='#share.type'/>">允许发布</a></li>
                                  </s:else>
                
                </ul>
            </div>
        </td>
    </tr>    
    </s:iterator>
    
    </tbody>
</table>
<s:iterator value="pageBean">  
    
<nav class="pull-right">
共<s:property value="allRow"/>条记录        
         共<s:property value="totalPage"/>页        
         当前第<s:property value="currentPage"/>页<br>    
    <ul class="pagination">
    <!--迭代页码-->
         <s:if test="%{currentPage == 1}">       
           <li class="disabled"><a  aria-label="Previous"><span aria-hidden="true">&laquo;</span></a></li>
          <li class="active"><a href="">1</a></li> 
          <s:bean name="org.apache.struts2.util.Counter" id="counter">
   <s:param name="first" value="2" />
   <s:param name="last" value="totalPage" />
   <s:iterator>  
    <li><a href="contentmanger.action?page=<s:property/>"><s:property/></a></li> 
   </s:iterator>
</s:bean>
         </s:if>    
         <!-- currentPage为当前页 -->    
         <s:else> 
         
      <li><a href="contentmanger.action?page=<s:property value="%{currentPage-1}"/>"><span aria-hidden="true">&laquo;</span></a></li>  
        <s:bean name="org.apache.struts2.util.Counter" id="counter">
   <s:param name="first" value="1" />
   <s:param name="last" value="currentPage-1" />
   <s:iterator>  
    <li><a href="contentmanger.action?page=<s:property/>"><s:property/></a></li> 
   </s:iterator>
</s:bean>              
       
          <li class="active"><a href="contentmanger.action?page=<s:property value="%{currentPage}"/>"><s:property value="%{currentPage}"/></a></li>       
          
          <s:bean name="org.apache.struts2.util.Counter" id="counter">
   <s:param name="first" value="currentPage+1" />
   <s:param name="last" value="totalPage" />
   <s:iterator>  
    <li><a href="contentmanger.action?page=<s:property/>"><s:property/></a></li> 
   </s:iterator>
</s:bean> 
    
         </s:else> 
         
          <s:if test="%{currentPage != totalPage}">    
         <li><a href="contentmanger.action?page=<s:property value="%{currentPage+1}"/>"><span aria-hidden="true">&raquo;</span></a> <li>     
         </s:if>    
         <s:else>    
          <li class="disabled"><a aria-label="Previous"><span aria-hidden="true">&raquo;</span></a></li>    
         </s:else>     
    </ul>
</nav>
</s:iterator>   
</div>
</div>
</div>
<!--footer-->
<footer>
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <p>
                    Copyright&nbsp;©&nbsp;2012-2015&nbsp;&nbsp;www.sharephoto.com&nbsp;&nbsp;粤ICP备13014270号-4
                </p>
            </div>
        </div>
    </div>
</footer>
<!--footer-->

<script src="${pageContext.request.contextPath}/JS/jquery-1.12.3.min.js"></script>
<script src="${pageContext.request.contextPath}/JS/bootstrap.min.js"></script>
</body>
</html>